﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Drawing;

namespace ChinessChess
{
  public abstract  class CQuanCo
    {
        public CQuanCo() {
        }
      //So o tren ban co
        private COCo[] m_flag = new COCo[90];

        public COCo[] flag{
            get { return m_flag; }
            set { m_flag = value; }
        }
        private ChessColor mcolor;
        private COCo m_oco;
        public COCo Oco{
            get { return m_oco; }
            set { m_oco = value; }
        }
      //Mau cua quan co
        public ChessColor Color{
            get { return mcolor; }
            set { mcolor = value; }
        }
      public CQuanCo(COCo oco, ChessColor color) {
            this.mcolor = color;
            this.m_oco = oco;
            oco.Color = color;
        }
        public CQuanCo(COCo []chess,ChessColor color){
            this.mcolor = color;
            this.m_flag = chess;
        }
        public abstract Boolean CheckIndex();
        public abstract Boolean CheckPoint();

        public virtual Boolean CheckEated(ChessColor nColor) {
            if (nColor != mcolor && nColor != ChessColor.Default) {
                return true;
            }
            return false;
        }
      //Kiem tra phai truoc co quan co nao can khong
        public virtual Boolean isCheck(int index){
            if (m_flag[index].State == true) {
                return true;
            }
            return false;
        }
        //Kiem tra phai truoc co quan co nao can khong
        public virtual Boolean isCheck(int index,ChessColor color){
            if (m_flag[index].State == true && m_flag[index].Color==color){
                return true;
            }
            return false;
        }

        public virtual Boolean KiemTraChieuTuong(int gIndex,int qIndex) {
            return false;
        }
    }
}
